﻿<script type="text/javascript">
    var chuku_info;
    $(function() {
        $("#chuku_chaxun").click(function() {
            //查询
            var dateKaiShi = $("#chuku_date_kaishi").datetimebox('getValue');
            var dateJieShu = $("#chuku_date_jieshu").datetimebox('getValue');
            var danWeiStr = $("#chuku_danweimingcheng").combobox('getText');
            var wuLiaoStr = $('#chuku_wuliaomingcheng').combobox('getText');
            var xingHaoStr = $("#chuku_xinghao").combobox('getText');
            var chePaiHaoStr = $("#chuku_chepaihao").textbox('getText');
            var zhanDianStr = $("#chuku_zhandian").combobox('getText');
            $("#chuku_mingxi").datagrid("load", { zhandian: zhanDianStr, chengzhongleixing: '出库物料', kaishishijian: dateKaiShi, jieshushijian: dateJieShu, danweimingcheng: danWeiStr, wuliaomingcheng: wuLiaoStr, xinghao: xingHaoStr, chepaihao: chePaiHaoStr,uid:window.uid,kid:window.kid });
        });
        $("#chuku_daochu").click(function() {
            //导出
            var dateKaiShi = $("#chuku_date_kaishi").datetimebox('getValue');
            var dateJieShu = $("#chuku_date_jieshu").datetimebox('getValue');
            var danWeiStr = $("#chuku_danweimingcheng").combobox('getText');
            var wuLiaoStr = $('#chuku_wuliaomingcheng').combobox('getText');
            var xingHaoStr = $("#chuku_xinghao").combobox('getText');
            var zhanDianStr = $("#chuku_zhandian").combobox('getText').replace('#', "_");
            var chePaiHaoStr = $("#chuku_chepaihao").textbox('getText');
            var yongHu = $("#currentUser").text();
            window.open(encodeURI("http://keaomds.com:10001/?uid="+window.uid+"&kid="+window.kid+"&requestType=1&keHuBianHao="+window.kehubianhao+"&zhandian=" + zhanDianStr + "&chengzhongleixing=出库物料&kaishishijian=" + dateKaiShi + "&jieshushijian=" + dateJieShu + "&danweimingcheng=" + danWeiStr + "&wuliaomingcheng=" + wuLiaoStr + "&xinghao=" + xingHaoStr + "&chepaihao=" + chePaiHaoStr + "&yonghu=" + yongHu));
        });

        $("#chuku_zhandian").combobox({
            url: 'json/zhandian.json',
            method: 'get',
            valueField: 'zhandian',
            textField: 'zhandian',
            panelWidth: 175,
            panelHeight: 'auto',
            editable: false,
            onLoadSuccess: function() {
                $("#chuku_mingxi").datagrid({ url: "handler/mingxi.ashx", method: "get", queryParams: {uid:window.uid,kid:window.kid, zhandian: $('#chuku_zhandian').combobox('getValue'), chengzhongleixing: '出库物料', kaishishijian: $("#chuku_date_kaishi").datetimebox('getValue'), jieshushijian: $("#chuku_date_jieshu").datetimebox('getValue') }, height: document.body.scrollHeight - 200, onSelect: function(index, row) {
                $("#chuku-info-danweimingcheng").text(row.danweimingcheng);
                $("#chuku-info-chepaihao").text(row.chepaihao);
                $("#chuku-info-wuliaomingcheng").text(row.wuliaomingcheng);
                $("#chuku-info-xinghao").text(row.xinghao);
                $("#chuku-info-maozhong").text(row.maozhong);
                $("#chuku-info-pizhong").text(row.pizhong);
                $("#chuku-info-kouzhong").text(row.kouzhong);
                $("#chuku-info-jingzhong").text(row.jingzhong);
                $("#chuku-info-fahuozhongliang").text(row.fahuozhongliang);
                $("#chuku-info-jisuanfangliang").text(row.jisuanfangliang);
                $("#chuku-info-maozhongshijian").text(row.maozhongshijian);
                $("#chuku-info-pizhongshijian").text(row.pizhongshijian);
                $("#chuku-info-caozuojilu").text(row.caozuojilu);
                $("#chuku-info-beizhu").text(row.beizhu);
                $("#chuku-info-maozhongrenyuan").text(row.maozhongrenyuan);
                $("#chuku-info-pizhongrenyuan").text(row.pizhongrenyuan);
                $("#chuku-info-chengzhongbianhao").text(row.chengzhongbianhao);
                    if (row.maozhongtupian1) {
                        $.get('handler/huoqutupian.ashx', { fileName: row.maozhongtupian1 }, function(data, status) {
                        $("#chuku-info-image1").attr('src', data);
                        });
                    }
                    if (row.maozhongtupian2) {
                        $.get('handler/huoqutupian.ashx', { fileName: row.maozhongtupian2 }, function(data, status) {
                        $("#chuku-info-image2").attr('src', data);
                        });
                    }
                    if (row.maozhongtupian3) {
                        $.get('handler/huoqutupian.ashx', { fileName: row.maozhongtupian3 }, function(data, status) {
                        $("#chuku-info-image3").attr('src', data);
                        });
                    }
                    if (row.pizhongtupian1) {
                        $.get('handler/huoqutupian.ashx', { fileName: row.pizhongtupian1 }, function(data, status) {
                        $("#chuku-info-image4").attr('src', data);
                        });
                    }
                    if (row.pizhongtupian2) {
                        $.get('handler/huoqutupian.ashx', { fileName: row.pizhongtupian2 }, function(data, status) {
                        $("#chuku-info-image5").attr('src', data);
                        });
                    }
                    if (row.pizhongtupian3) {
                        $.get('handler/huoqutupian.ashx', { fileName: row.pizhongtupian3 }, function(data, status) {
                        $("#chuku-info-image6").attr('src', data);
                        });
                    }
                } 
                });
            }
        });

        $("#chuku_danweimingcheng").combobox({
            url: 'handler/danwei.ashx',
            method: 'get',
            queryParams: { danweileixing: "出库单位",uid:window.uid,kid:window.kid },
            valueField: 'danwei',
            textField: 'danwei',
            panelWidth: 175,
            panelHeight: 200,
            editable: false
        });

        $("#chuku_wuliaomingcheng").combobox({
            url: 'handler/wuliao.ashx',
            method: 'get',
            queryParams: { wuliaoleixing: "出库物料", uid: window.uid, kid: window.kid },
            valueField: 'id',
            textField: 'wuliao',
            panelWidth: 175,
            panelHeight: 200,
            editable: false,
            onSelect: function(record) {
            $("#chuku_xinghao").combobox({
                    url: 'handler/xinghao.ashx',
                    method: 'get',
                    queryParams: { wuliaoid: record.id, uid: window.uid, kid: window.kid },
                    valueField: 'xinghao',
                    textField: 'xinghao',
                    panelWidth: 175,
                    panelHeight: 200,
                    editable: false
                });
            }
        });

        $("#chuku_xinghao").combobox({
            data: [{ xinghao: '—全部—', selected: true}],
            valueField: 'xinghao',
            textField: 'xinghao',
            panelWidth: 175,
            panelHeight: 200,
            editable: false
        });

        chuku_info = function showChuKuInfo() {
            //显示明细窗口
        $("#chuku-info").dialog('open');
        }

        $("#chuku-image tr td img").click(function() {
        $("#chuku-big-image img").attr('src', $(this).attr('src'));
        $("#chuku-big-image").show();
        $("#chuku-content").hide();
        });
        $("#chuku-big-image").click(function() {
        $("#chuku-big-image").hide();
        $("#chuku-content").show();
        });

    });
    $.parser.onComplete = function() {
        var d = new Date();
        $("#chuku_date_kaishi").datetimebox('setValue', d.toLocaleDateString() + " 00:00:00");
        $("#chuku_date_jieshu").datetimebox('setValue', d.toLocaleDateString() + " 23:59:59");
    }
</script>

<div class="easyui-panel" data-options="height:110,border:false" title="数据检索" style="border-top-width: 0px;
    border-bottom-width: 1px; padding: 10px; width:100%">
    <table style="font-size: 12px;">
        <tr>
            <td>
                站点：
            </td>
            <td>
                <input class="" name="chuku_zhandian" id="chuku_zhandian" style="width: 175px;" />
            </td>
            <td>
                称重时间：
            </td>
            <td>
                <input id="chuku_date_kaishi" type="text" class="easyui-datetimebox" data-options="required:true,showSeconds:true"
                    style="width: 175px">
                   </td>
            <td  align="center">
                至
            </td>
            <td>
                <input id="chuku_date_jieshu" type="text" class="easyui-datetimebox" data-options="required:true,showSeconds:true"
                    style="width: 175px">
            </td>
        </tr>
        <tr>
            <td>
                单位名称：
            </td>
            <td>
                <input id="chuku_danweimingcheng" name="chuku_danweimingcheng" data-options="" style="width: 175px">
            </td>
            <td>
                物料名称：
            </td>
            <td>
                <input id="chuku_wuliaomingcheng" name="chuku_wuliaomingcheng" data-options="" style="width: 175px">
            </td>
            <td>
                型号：
            </td>
            <td>
                <input id="chuku_xinghao" name="chuku_xinghao" data-options="" style="width: 175px">
            </td>
            <td>
                车号：
            </td>
            <td>
                <input id="chuku_chepaihao" name="chuku_chehao" type="text" class="easyui-textbox"
                    data-options="" style="width: 90px">
            </td>
            <td>
                <a id="chuku_chaxun" class="easyui-linkbutton" data-options="iconCls:'icon-search'"
                    style="width: 60px; margin-left: 20px;">查询</a>
            </td>
            <td>
                <a id="chuku_daochu" class="easyui-linkbutton" data-options="iconCls:'icon-export-16'"
                    style="width: 60px">导出</a>
            </td>
        </tr>
    </table>
</div>
<table id="chuku_mingxi" class="easyui-datagrid" title="出库物资明细" data-options="border:false,singleSelect:true,collapsible:false,fitColumns:true,striped:true" style="width:100%">
    <thead>
        <tr>
            <th data-options="field:'chengzhongbianhao'">
                称重编号
            </th>
            <th data-options="field:'chepaihao'">
                车牌号
            </th>
            <th data-options="field:'wuliaomingcheng'">
                物料名称
            </th>
            <th data-options="field:'xinghao'">
                型号
            </th>
            <th data-options="field:'danweimingcheng'">
                单位名称
            </th>
            <th data-options="field:'kouzhong',align:'right'">
                扣重(吨)
            </th>
            <th data-options="field:'jingzhong',align:'right'">
                净重(吨)
            </th>
            <th data-options="field:'jisuanfangliang',align:'right'">
                方量(方)
            </th>
            <th data-options="field:'maozhongshijian'">
                毛重时间
            </th>
            <th data-options="field:'pizhongshijian'">
                皮重时间
            </th>
            <th data-options="field:'id',formatter:function(value,row,index){if(value){ return '<a href=javascript:void(0) onClick=chuku_info()>详细</a>';}}">
            </th>
        </tr>
    </thead>
</table>

<style type="text/css">
    .table-bordered
    {
        border-style: solid;
        border-width: 1px;
        border-color: #dddddd;
        border-collapse: collapse;
        border-spacing: 0;
        margin:0;
        padding:0;
    }
    .table-bordered td 
    {
        border-style: solid;
        border-width: 1px;
        border-color: #dddddd;
    }
    .table-striped tr:nth-child(2n) 
    {
      background: #f9f9f9;
    }
</style>

<div id="chuku-info" class="easyui-dialog" title="出库物资称重明细" data-options="modal:true,closed:true,iconCls:'icon-tip',draggable:false,collapsible:false,minimizable:false,maximizable:false,resizable:false"
    style="width: 750px; height: 500px; padding: 10px;">
    <div style="width:100%; height:100%; display: none" id="chuku-big-image">
        <img src="" alt="" width="100%" height="100%" />
    </div>
    <div style="width: 680px; margin: 0 auto;" id="chuku-content">
        <table cellpadding="5" style="font-size: 13px; margin: 0 auto;
            width:660px;" class="table-bordered table-striped">
               <tr>
                <td style="width:20%;" align="center">
                    磅单号
                </td>
                <td colspan="3" align="left">
                    <label id="chuku-info-chengzhongbianhao">
                    </label>
                </td>
            </tr>
            <tr>
                <td style="width:20%;" align="center">
                    单位名称
                </td>
                <td style="width:30%;" align="left">
                    <label id="chuku-info-danweimingcheng">
                    </label>
                </td>
                <td style="width:20%;" align="center">
                    车牌号
                </td>
                <td style="width:30%;" align="left">
                    <label id="chuku-info-chepaihao">
                    </label>
                </td>
            </tr>
            <tr>
                <td style="width:20%;" align="center">
                    物料名称
                </td>
                <td style="width:30%;" align="left">
                    <label id="chuku-info-wuliaomingcheng">
                    </label>
                </td>
                <td style="width:20%;" align="center">
                    型号
                </td>
                <td style="width:30%;" align="left">
                    <label id="chuku-info-xinghao">
                    </label>
                </td>
            </tr>
            <tr>
                <td style="width:20%;" align="center">
                    毛重(吨)
                </td>
                <td style="width:30%;" align="left">
                    <label id="chuku-info-maozhong">
                    </label>
                </td>
                <td style="width:20%;" align="center">
                    皮重(吨)
                </td>
                <td style="width:30%;" align="left">
                    <label id="chuku-info-pizhong">
                    </label>
                </td>
            </tr>
            <tr>
                <td style="width:20%;" align="center"> 
                    扣重(吨)
                </td>
                <td style="width:30%;" align="left">
                    <label id="chuku-info-kouzhong">
                    </label>
                </td>
                <td style="width:20%;" align="center">
                    净重(吨)
                </td>
                <td style="width:30%;" align="left">
                    <label id="chuku-info-jingzhong">
                    </label>
                </td>
            </tr>
            <tr>
                <td style="width:20%;" align="center">
                    发货(吨)
                </td>
                <td style="width:30%;" align="left">
                    <label id="chuku-info-fahuozhongliang">
                    </label>
                </td>
                <td style="width:20%;" align="center">
                    方量(吨)
                </td>
                <td style="width:30%;" align="left">
                    <label id="chuku-info-jisuanfangliang">
                    </label>
                </td>
            </tr>
                 <tr>
                <td style="width:20%;" align="center">
                    毛重操作员
                </td>
                <td style="width:30%;" align="left">
                    <label id="chuku-info-maozhongrenyuan">
                    </label>
                </td>
                <td style="width:20%;" align="center">
                    皮重操作员
                </td>
                <td style="width:30%;" align="left">
                    <label id="chuku-info-pizhongrenyuan">
                    </label>
                </td>
            </tr>
            <tr>
                <td style="width:20%;" align="center">
                    毛重时间
                </td>
                <td align="left" style="width:30%;">
                    <label id="chuku-info-maozhongshijian">
                    </label>
                </td>
                               <td style="width:20%;" align="center">
                    皮重时间
                </td>
                <td align="left" style="width:30%;">
                    <label id="chuku-info-pizhongshijian">
                    </label>
                </td>
            </tr>
            <tr>
                <td style="width:20%;" align="center">
                    操作记录
                </td>
                <td colspan="3" align="left">
                    <label id="chuku-info-caozuojilu">
                    </label>
                </td>
            </tr>
            <tr>
                <td style="width:20%;" align="center">
                    备注
                </td>
                <td colspan="3" align="left">
                    <label id="chuku-info-beizhu">
                    </label>
                </td>
            </tr>
        </table>
       
        <table style="width:660px; margin:0 auto; margin-top:10px" id="chuku-image">
            <tr>
                <td align="center">
                    <img id="chuku-info-image1" src="js/themes/noPic.jpg" width="320" height="240" alt="进场图片" />
                </td>
                <td  align="center">
                    <img id="chuku-info-image4" src="js/themes/noPic.jpg"  width="320" height="240"  alt="出场图片" />
                </td>
            </tr>
            <tr>
                <td align="center">
                    <img id="chuku-info-image2" src="js/themes/noPic.jpg"  width="320" height="240"  alt="进场图片" />
                </td>
                <td align="center">
                    <img id="chuku-info-image5" src="js/themes/noPic.jpg"  width="320" height="240"  alt="出场图片" />
                </td>
            </tr>
            <tr>
                <td align="center">
                    <img id="chuku-info-image3" src="js/themes/noPic.jpg"  width="320" height="240"  alt="进场图片" />
                </td>
                <td align="center">
                    <img id="chuku-info-image6" src="js/themes/noPic.jpg"  width="320" height="240"  alt="出场图片" />
                </td>
            </tr>
        </table>
    </div>
</div>

